﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace ClassAdd
{
    class ControlClassDescription
    {     

        public void writeClass(string className, string nameSpace, string pathToWrite, String pathToTemplate)
        {

            Directory.CreateDirectory(pathToWrite + "\\Controllers\\");           
            String maskString = File.ReadAllText(pathToTemplate + "\\Controllers\\Controller.txt");
            maskString = maskString.Replace("NAMESPACE", nameSpace);

            try
            {
                File.WriteAllText(pathToWrite + "\\Controllers\\" + className+"Controller.cs", maskString.Replace("MASK", className));
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

        }
    }
}
